from selenium import webdriver
from selenium.webdriver.common.by import By
import unittest
from time import sleep


class login:

    def __init__(self):
        self.driver = webdriver.Chrome()
        self.driver.get("http://localhost:8080")
        self.driver.implicitly_wait(5)

    def login(self):
        self.driver.find_element(By.NAME, "code").clear()
        self.driver.find_element(By.NAME, "code").send_keys("admin")
        self.driver.find_element(By.NAME, "password").clear()
        self.driver.find_element(By.NAME, "password").send_keys("123456")
        self.driver.find_element(By.XPATH, "/html/body/form/div[3]/div/button").click()
        sleep(3)


if __name__ == "__main__":
    login()
